<template>
  <div class="link" @click="handleClick(link.ip_address)">
    <div class="left">
      <img :src="link.icon" alt="" />
    </div>
    <div class="right">
      <div class="info-title">{{ link.name }}</div>
      <div class="info-desc">{{ link.description }}</div>
    </div>
  </div>
</template>
<script setup>
const $props = defineProps(["link"]);

const handleClick = (url) => {
  window.open(url);
};
</script>
<style lang="scss" scoped>
.link {
  width: 100%;
  height: 120px;
  cursor: pointer;
  display: flex;
  position: relative;
  align-items: center;
  border-radius: 10px;
  margin-left: 10px;
  background-color: #8fbca275;
  padding: 10px;
  &:hover {
    color: #fff;

    box-shadow: 2px 2px 10px 5px #49b0f563;
    transition: all 0.2s;
    &::before {
      transform: scale(1);
    }
    .info-desc {
      color: #fff;
    }

    .left img {
      width: 0;
    }
  }
  &::before {
    z-index: 1;
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: #3a8ee6;
    transition-timing-function: ease-out;
    transition-duration: 0.35s;
    transition-property: transform;
    transform: scale(0);
    border-radius: 10px;
  }
  .left {
    margin: 0 10px;
    img {
      transition: all 0.35s ease;
      border-radius: 50%;
      width: 50px;
      height: 50px;
      margin:3px 0;
      margin-right: 8px;
    }
  }
  .right {
    z-index: 2;
    margin-left: 15px;
    .info-title {
      position: relative;
      font-weight: 700;
      padding-bottom: 5px;
      margin-bottom: 10px;
      overflow: hidden;
      text-overflow: ellipsis;
      -webkit-line-clamp: 2;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      min-width: 60%;
      &::after {
        content: "";
        width: 50%;
        height: 2px;
        position: absolute;
        bottom: 0;
        left: 0;
        background-color: #000;
      }
    }
    .info-desc {
      overflow: hidden;
      text-overflow: ellipsis;
      -webkit-line-clamp: 2;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      min-width: 60%;
    }
  }
}
@media screen and (max-width:1024px) {
    .link {
      height: auto;
    }
} 
</style>
